home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HyperLib 1997 Winter - Disc 1
/
HYPERLIB-1997-Winter-CD1.ISO.7z
/
HYPERLIB-1997-Winter-CD1.ISO
/
オンラインウェア
/
BUS
/
TMCM Software and Labs.sit
/
Software for TMCM 7_95
/
Files For Lab 8
/
EchoChars
< prev
next >
Wrap
Text File
|
1995-07-13
|
2KB
|
32 lines
; This program illustrates the I/O capabilities of xComputer.
; To use this program, you must turn on the "Use I/O Services"
; option in the "Options" menu. (If this option is off, the
; computer will not recognize the I/O instructions gtc and ptc
; when the program is run.)
; The program gets characters input by the user and echos them
; to output until the user types a carriage return. Then the
; program terminates.
get_ch: gtc ; Get the next char from input and load it into accumulator.
jmz get_ch ; A value of zero indicates that no character was input.
sto ch ; If the value is non-zero, save it in location "ch".
; (Note that it is actually the ASCII code of the
; character that is being saved here.)
lod ch ; Get the input char from location "ch" (into the AC).
sub-c 13 ; Compare it to "carriage return" by subtracting 13,
; the ASCII code of a carriage return character.
jmz done ; If it's a carriage return, jump to location "done".
lod ch ; Get the input char from location "ch".
ptc ; Write the character (now in AC) to output.
jmp get_ch ; Jump to "get_ch" to process the next character.
done: hlt ; Program ends.
ch: data ; Location to hold a character input from user
; while it is being processed.